<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>好友列表</title>
</head>
<style>
body {
    font-family: 'Arial', sans-serif;
}

.friend-list {
    width: 300px;
    margin: 0 auto;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f8f8f8;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
}

ul {
    list-style-type: none;
    padding: 0;
}

li {
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
}

li:hover {
    background-color: #e6e6e6;
}
</style>
<body>
    <div class="friend-list">
        <h1>我的好友列表</h1>
        <ul id="friends">
            <!-- 好友列表项将在此处动态添加 -->
        </ul>
    </div>
</body>
</html>

<script>
// 这里可以使用Fetch API或其他方法来获取好友数据
// 为了简化示例，我们使用一个静态的好友数组
const friends = [
    { name: '张三', avatar: 'https://via.placeholder.com/100' },
    { name: '李四', avatar: 'https://via.placeholder.com/100' },
    // ... 其他好友数据
];

const friendsList = document.getElementById('friends');

friends.forEach(friend => {
    const li = document.createElement('li');
    li.innerHTML = `
        <img src="${friend.avatar}" alt="${friend.name}">
        <span>${friend.name}</span>
    `;
    friendsList.appendChild(li);
});
</script>
